import 'package:flutter/material.dart';
import './home.dart';
import 'my/main.dart';
import 'Show/main.dart';

class Navigation extends StatefulWidget {
  const Navigation({super.key});

  @override
  State<StatefulWidget> createState() => _NavigationBar();
}

class _NavigationBar extends State<Navigation> {
  var allPages = [const Home(), const Show(), const My()];
  var currentIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // body: IndexedStack(
      //   index: currentIndex,
      //   children: allPages,
      // ),
      body: allPages[currentIndex],
      backgroundColor: const Color.fromARGB(255, 60, 155, 234),
      bottomNavigationBar: BottomNavigationBar(
          currentIndex: currentIndex,
          type: BottomNavigationBarType.fixed,
          unselectedItemColor: Colors.grey,
          selectedItemColor: Colors.red,
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: "首页",
              //backgroundColor:Colors.blue
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.print_outlined),
              label: "展示",
              //backgroundColor:Colors.blue
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: "我的",
              //backgroundColor:Colors.blue
            ),
          ],
          onTap: (index) {
            setState(() {
              currentIndex = index;
            });
          }),
    );
  }
}
